home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_fixminecar.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  369 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_fixminecar.cog
  4. #    
  5. # Fix the mine car to exit the level
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12. message    startup
  13. message    activated
  14. message    entered
  15. message    exited
  16. message    callback
  17.  
  18. # actors
  19. thing    player            nolink    local
  20. thing    indyactor0        nolink    # fixes wheel
  21. thing    indyactor1                # fills tank
  22. thing    indyactor2                # floater discusses the minecar situation
  23.  
  24. # world things
  25. thing    goodwheel        nolink
  26. thing    badwheel        nolink
  27. thing    brokencar
  28. thing    goodcar            nolink
  29. thing    hint59
  30. thing    railblock1        nolink
  31. thing    railblock2        nolink
  32.  
  33. # camera things
  34. thing    wheelcam        nolink
  35. thing    gascam            nolink
  36.  
  37. # swappable Indy hand
  38. model    sourceModel=hand_in_gascan.3do        local
  39.  
  40. # surfaces
  41. surface    gasface
  42.  
  43. # voicelines
  44. sound    goodshape=pr15j03.wav        local
  45. sound    allitneeds=pr15j04.wav        local
  46. sound    mightstillrun=pr15j07.wav    local
  47. sound    ifit=pr15j08.wav            local
  48. sound    hadsomegas=pr15j09.wav        local
  49. sound    hadawheel=pr15j10.wav        local
  50. sound    allaboard=pr15j11.wav        local
  51.  
  52. # non-voice sounds
  53. sound    attachwheel=sea_launch_wheel_attach.wav    local
  54. sound    cartilt=sea_crane_stop_c.wav            local
  55. sound    filltank=jep_gascan_pour.wav            local
  56.  
  57. # animations
  58. keyframe    putwheel=in_useitem.key            local
  59. keyframe    pourgas=0in_pourgasoline.key    local
  60. keyframe    conductor=0in_nod_4_4.key        local
  61.  
  62. # variables
  63. int        carstatus=-1    local
  64. int        actornum=0        local
  65. int        oktogas=0        local
  66. int        swapRef=0            local
  67. int        callNum                local
  68.  
  69. # subroutines
  70. flex    startscene=0.0        local
  71. flex    endscene=0.0        local
  72. flex    fixcams=0.0            local
  73. flex    hintlines=0.0        local
  74. flex    installwheel=0.0    local
  75. flex    fillerup=0.0        local
  76. flex    changecam1=0.0        local
  77. flex    changecam2=0.0        local
  78. end
  79.  
  80. code
  81. startup:
  82.     sleep(.01);
  83.     player = GetLocalPlayerThing();
  84.         
  85.     AttachThingToThing(goodwheel, brokencar);
  86.     AttachThingToThing(badwheel, brokencar);
  87.  
  88.     SetThingFlags(goodcar, 0x80000);
  89.     ClearThingFlags(brokencar, 0x80);
  90.     ClearThingFlags(brokencar, 0x40);
  91.     SetThingFlags(badwheel, 0x10);
  92.  
  93.     # make railblocks non-mountable
  94.     ClearThingFlags(railblock1, 0x80);
  95.     ClearThingFlags(railblock2, 0x80);
  96.  
  97.     return;
  98.  
  99. # carstatus key:
  100. #    -1 = never activated
  101. #    0 = activated, never fixed
  102. #    1 = wheel fixed
  103. #    2 = fuel added
  104. #    3 = entirely fixed
  105.     
  106. activated:
  107. # ---> MineCar
  108.     
  109.     if (GetSenderRef() != brokencar) return;
  110.  
  111.     # if player holding wheel and is close to wheel actor, install it
  112.     if ((GetCurItem(player) == 64) && (VectorDist(GetThingPos(player), GetThingPos(indyactor0)) < .1))
  113.     {
  114.         # prepare player
  115.         if (MakeMeStop() == -1) return;
  116.         DeselectWeaponWait(player);
  117.         
  118.         call installwheel;
  119.     }
  120.     # if player is holding gas can and is on the right face, gas it up
  121.     else if ((GetCurItem(player) == 66) && (oktogas))
  122.     {
  123.         # prepare player
  124.         if (MakeMeStop() == -1) return;
  125.         DeselectWeaponWait(player);
  126.         
  127.         call fillerup;
  128.     }
  129.     # otherwise, indy says something
  130.     else
  131.     {
  132.         # prepare player
  133.         if (MakeMeStop() == -1) return;
  134.         DeselectWeaponWait(player);
  135.         
  136.         call hintlines;
  137.  
  138.         # back to reality
  139.         SetThingFlags(indyactor2, 0x80000);
  140.         ClearThingFlags(player, 0x80000);
  141.         ClearActorFlags(player, 0x200000);
  142.         RestoreExtCam();
  143.         EndCutscene();
  144.     
  145.         sleep(.75);
  146.             
  147.         return;
  148.     }
  149.  
  150.     # if minecar is fully fixed
  151.     if (1)
  152.     if (carstatus == 3)
  153.     {
  154.         sleep(1);
  155.         PlayKey(indyactor0[actornum], conductor, 4, 0x12, 0);
  156.         PlayVoice(player, allaboard, 1, 1);
  157.         SetHintSolved(hint59);
  158.         DestroyThing(hint59);
  159.         
  160.         DestroyThing(brokencar);
  161.         DestroyThing(goodwheel);
  162.         DestroyThing(badwheel);
  163.         DestroyThing(indyactor2);
  164.  
  165.         ClearThingFlags(goodcar, 0x80000);
  166.     }
  167.     
  168.     call endscene;
  169.     return;
  170.  
  171. entered:
  172. # ---> gasface    
  173.     if (GetSenderRef() != gasface) return;
  174.     oktogas = 1;
  175.     return;
  176.  
  177. exited:
  178. # ---> gasface    
  179.     if (GetSenderRef() != gasface) return;
  180.     oktogas = 0;
  181.     return;
  182.  
  183. hintlines:
  184.     StartCutscene(1);
  185.     
  186.     # switcheroo to floating actor
  187.     TeleportThing(indyactor2, player);
  188.     CopyPlayerHolsters(player, indyactor2);
  189.     ClearThingFlags(indyactor2, 0x80000);
  190.     SetActorFlags(player, 0x200000);
  191.     SetThingFlags(player, 0x80000);
  192.     
  193.     # start the action
  194.     SetExtCamOffset('0.15 -.1 0.09');
  195.     SetThingMaxRotVel(indyactor2, 175);
  196.     SetThingMaxHeadVel(indyactor2, 175);
  197.     AISetLookThing(indyactor2, brokencar);
  198.     AIWaitForStop(indyactor2);
  199.     
  200.     Sleep(1.0);
  201.  
  202.     #say firsttime sayline or portion of later saylines
  203.     if (carstatus == -1)
  204.     {
  205.         #Indy: You know, this mine car is in pretty good shape
  206.         PlayVoice(player, goodshape, 1, 1);
  207.         sleep(1);
  208.         
  209.         #Indy: All it needs are a wheel and some fuel
  210.         PlayVoice(player, allitneeds, 1, 1);
  211.         
  212.         carstatus = 0;
  213.         return;
  214.     }
  215.     else
  216.     {
  217.         #Indy: This thing might still run...
  218.         PlayVoice(player, mightstillrun, 1, 1);
  219.     }
  220.     
  221.     if (carstatus == 0)
  222.     {
  223.         #Indy: ...if it had a wheel and some gas
  224.         PlayVoice(player, ifit, 1, 1);
  225.     }
  226.     
  227.     if (carstatus == 1)
  228.     {
  229.         #Indy: ...if it had some gas
  230.         PlayVoice(player, hadsomegas, 1, 1);
  231.     }
  232.     
  233.     if (carstatus == 2)
  234.     {
  235.         #Indy: ...if it had a wheel
  236.         PlayVoice(player, hadawheel, 1, 1);
  237.     }
  238.  
  239.     return;
  240.  
  241. installwheel:
  242.     #in case player hasn't gotten initial hint yet
  243.     if (carstatus == -1) carstatus = 0;
  244.  
  245.     #install the wheel on the mine car
  246.     actornum = 0;
  247.     call startscene;
  248.     call changecam1;
  249.         
  250.     #play crouch anim, rotate car back into position
  251.     PlayKey(indyactor0, putwheel, 4, 0x12, 0);
  252.     sleep(1);
  253.     PlaySoundThing(attachwheel, badwheel, 1, -1, -1, 0);
  254.     sleep(.5);
  255.     MoveToFrame(brokencar, 1, 1);
  256.     sleep(.2);
  257.     PlaySoundThing(cartilt, brokencar, 1, -1, -1, 0);
  258.  
  259.     # make wheel visible and wait
  260.     ClearThingFlags(badwheel, 0x10);
  261.     Sleep(2);
  262.  
  263.     #remove wheel from inventory
  264.     ChangeInv(player, 64, -1);
  265.     
  266.     #update carstatus
  267.     carstatus = carstatus + 1;
  268.     return;
  269.     
  270. fillerup:
  271.     # capture player for callback
  272.     CaptureThing(indyactor1);
  273.     
  274.     #in case player hasn't gotten initial hint yet
  275.     if (carstatus == -1) carstatus = 0;
  276.  
  277.     #fill up the gas tank
  278.     actornum = 1;
  279.     call startscene;
  280.     call changecam2;
  281.     
  282.     #play pour animation
  283.     AISetLookThing(indyactor1, brokencar);
  284.     Sleep(.5);
  285.     PlayKey(indyactor1, pourgas, 4, 0x12, 0);
  286.     Sleep(1);
  287.     PlaySoundThing(filltank, indyactor1, 1, -1, -1, 0);
  288.     Sleep(6);
  289.  
  290.     #remove gas from inventory
  291.     ChangeInv(player, 66, -1);
  292.     
  293.     #update carstatus
  294.     carstatus = carstatus + 2;
  295.     
  296.     return;
  297.  
  298. changecam1:
  299.     #change to wheelcam
  300.     SetCameraFocus(2, wheelcam);
  301.     SetCameraSecondaryFocus(2, indyactor0);
  302.     SetCurrentCamera(2);
  303.     ResetCameraFOV(0, 0);
  304.     return;
  305.  
  306. changecam2:
  307.     #change to gascam
  308.     SetCameraFocus(2, gascam);
  309.     SetCameraSecondaryFocus(2, indyactor1);
  310.     SetCurrentCamera(2);
  311.     ResetCameraFOV(0, 0);
  312.     return;
  313.     
  314. startscene:
  315.     call fixcams;
  316.  
  317.     StartCutscene(1);
  318.     CopyPlayerHolsters(player, indyactor0[actornum]);
  319.     ClearThingFlags(indyactor0[actornum], 0x80000);
  320.     SetActorFlags(player, 0x200000);
  321.     SetThingFlags(player, 0x80000);
  322.         
  323.     return;
  324.             
  325. endscene:
  326.     call fixcams;
  327.  
  328.     TeleportThing(player, indyactor0[actornum]);
  329.     SetThingFlags(indyactor0[actornum], 0x80000);
  330.     ClearThingFlags(player, 0x80000);
  331.     ClearActorFlags(player, 0x200000);
  332.     SetCameraSecondaryFocus(2, player);
  333.  
  334.     SetCurrentCamera(1);
  335.     EndCutscene();
  336.     return;
  337.  
  338. fixcams:
  339.     #reset camera settings
  340.     ResetCameraFOV(0, 0);
  341.     SetCameraPosInterp(2, 0);
  342.     SetCameraLookInterp(2, 0);
  343.     SetCameraPosInterp(1, 0);
  344.     SetCameraLookInterp(1, 0);
  345.     RestoreExtCam();
  346.     return;
  347.  
  348. callback:
  349.     if (GetSenderRef() != indyactor1) return;
  350.     callNum = GetParam(1);
  351.  
  352.     if (callNum == 21)
  353.     {
  354.         # Put can in hand
  355.         swapRef = SetThingMesh(indyactor1, 15, sourceModel, 0);
  356.     }
  357.     else if (callNum == 22)
  358.     {
  359.         # Get rid of can
  360.         RestoreThingMesh(indyactor1, swapRef);
  361.         ReleaseThing(indyactor1);
  362.     }
  363.         
  364.     return;
  365.     
  366.  
  367. end
  368.  
  369.